<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1100">

<!-- title/descriptions -->
{%- assign page_url_parts = page.url | split: '/' -%}
{%- assign max_ind = page_url_parts.size | minus: 1 -%}
{%- assign title_parts = "" | split: "" -%}
{% assign is_directory = page.url | endswith: "/" %}

{% if max_ind == 1 and include.mode=='documentation' %}{%- assign max_ind = 2 -%}{% endif %}

{%- for i in (2..max_ind) %}

{%- capture current_breadcrumb_url %}{{ next_prepender }}/{{ page_url_parts[i] }}{% endcapture -%}
{%- capture next_prepender %}{{ next_prepender }}/{{ page_url_parts[i] }}{% endcapture -%}
{%- capture page_url_without_lang %}{{ page_url_without_lang }}/{{ page_url_parts[i] }}{% endcapture -%}

{%- assign breadcrumb = site.data.breadcrumbs[current_breadcrumb_url] %}
{%- if breadcrumb %}
    {%- if breadcrumb.title[page.lang] %}
    {%- assign title = breadcrumb.title[page.lang] %}
    {% else %}
    {%- assign title = breadcrumb.title %}
    {% endif -%}
    {%- assign title_parts = title_parts | push: title -%}
{%- endif -%}
{%- endfor %}

{%- assign title_parts = title_parts | push: page.title -%}

{%- if page_url_without_lang.size > 1 and is_directory %}
{%- assign page_url_without_lang = page_url_without_lang | append: '/' %}
{%- endif %}

{%- assign generated_title = title_parts | reverse | join: " / " %}
<title>{{ generated_title }} | {{ site.site_title }}</title>
{% if page.description %}
    {%- assign description = page.description | strip_html | strip_newlines | strip | truncate: 200 %}
{% else %}
    {%- assign description = site.site_description[page.lang] | strip_html | strip_newlines | strip | truncate: 200 %}
{% endif %}

{%- if include.mode=='documentation' %}
{%- assign page_meta_url = site.canonical_url_prefix | append: (page_url_without_lang | relative_url) %}
{%- else %}
{%- assign page_meta_url = page_url_without_lang | relative_url %}
{% endif %}
<!-- multilang -->
{%- if page.multilang %}
    <link data-proofer-ignore rel="alternate" hreflang="ru" href="{{ site.urls['ru'] }}{{ page_meta_url }}" />
    <link data-proofer-ignore rel="alternate" hreflang="en" href="{{ site.urls['en'] }}{{ page_meta_url }}" />
{%- endif %}

<!-- Primary Meta Tags -->
<meta name="title" content="{{ generated_title }} | {{ site.site_title }}">
<meta name="description" content="{{ description }}">
<meta name="keywords" content="{{page.tags}}{% if page.tags %}, {% endif %}{% if page.keywords %}{{page.keywords}}, {% endif %}{% if page.search %}{{page.search}}{% endif %}">

<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:url" content="{{ site.urls[page.lang] }}{{ page_meta_url }}">
<meta property="og:title" content="{{ generated_title }} | {{ site.site_title }}">
<meta property="og:description" content="{{ description }}">

<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:url" content="{{ site.urls[page.lang] }}{{ page_meta_url }}">
<meta property="twitter:title" content="{{ generated_title }} | {{ site.site_title }}">
<meta property="twitter:description" content="{{ description }}">
